<%@page import="java.net.URLEncoder"%>
<%@page import="com.mongodb.DBCursor"%>
<%@page import="com.mongodb.DBObject"%>
<%
DBObject dbObject = (DBObject)session.getAttribute("users");
DBCursor cursor = (DBCursor) request.getAttribute("cursor"); 
String[] listError = (String[]) request.getAttribute("listError");
String success = (String)request.getAttribute("success");
%>

<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="" />
	<jsp:param name="description" value="" />
	<jsp:param name="keywords" value="" />
	<jsp:param name="page" value="home" />
</jsp:include>

<div id="userform" class="clearafter">
	<h1>Get Auto Content</h1><hr/>
	<div class="submitlink">
		<form method="post" action="" name="submitlink">
			<p>
				<%=success!=null?"<span style=\"color: blue\">"+success+"</span><br/>":""  %>
				<%=listError[0]!=null?"<span style=\"color: red\">"+listError[0]+"</span><br/>":"" %>
				<%=listError[4]!=null?"<span style=\"color: red\">"+listError[4]+"</span><br/>":"" %>
				<label> Sitemaps (<a href="javascript:void(0)" style="display: inline;" id="checkreg">Older Selector</a>) 
				&nbsp;<img alt="Question" src="/images/i-help.gif" class="question"/>
				<span class="note">
					Add Url of Site that you want to auto get Content.
				</span>
				<br /> <input class="input" type="text"
					name="sitemap" id="sitemap" value="<%=request.getAttribute("sitemap")!=null?request.getAttribute("sitemap"):""%>"/> </label>
			</p>
			<p>
				<div style="border: 1px solid #CCC;margin-bottom: 10px;padding: 5px;max-height: 300px;overflow: auto;width: 96%;" id='showreg'></div>
			</p>
			<p>
				HTML <input class="input type" type="radio"
					name="type"  style="width: auto;"  value="html" <%=(request.getAttribute("type")!=null&&request.getAttribute("type").equals("html"))?"checked=\"checked\"":""%> <%=request.getAttribute("type")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;&nbsp;&nbsp;
				RSS <input class="input type" type="radio"
					name="type"  style="width: auto;" value="rss" <%=(request.getAttribute("type")!=null&&request.getAttribute("type").equals("rss"))?"checked=\"checked\"":""%>/>
				&nbsp;<img alt="Question" src="/images/i-help.gif" class="question"/>
				<span class="note">
					Content contain Html or Rss. Best to choose Html.
				</span>	
					
			</p>
			<p>
				Nofollow <input class="input type" type="radio"
					name="typeLink"  style="width: auto;"  value="nofollow" <%=(request.getAttribute("typeLink")!=null&&request.getAttribute("typeLink").equals("nofollow"))?"checked=\"checked\"":""%> <%=request.getAttribute("typeLink")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;&nbsp;&nbsp;
				Follow <input class="input type" type="radio"
					name="typeLink"  style="width: auto;" value="dofollow" <%=(request.getAttribute("typeLink")!=null&&request.getAttribute("typeLink").equals("dofollow"))?"checked=\"checked\"":""%>/>
				&nbsp;<img alt="Question" src="/images/i-help.gif" class="question"/>
				<span class="note">
					Set link at your Blog is Nofollow if you choose Nofollow and too same for Follow
				</span>	
			</p>
			<p>
				Source : 
				Yes <input class="input type" type="radio"
					name="source"  style="width: auto;"  value="yes" <%=(request.getAttribute("source")!=null&&request.getAttribute("source").equals("yes"))?"checked=\"checked\"":""%> <%=request.getAttribute("source")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;&nbsp;&nbsp;
				No <input class="input type" type="radio"
					name="source"  style="width: auto;" value="no" <%=(request.getAttribute("source")!=null&&request.getAttribute("source").equals("yes"))?"checked=\"checked\"":""%>/>
				&nbsp;<img alt="Question" src="/images/i-help.gif" class="question"/>
				<span class="note">
					Display from Source by choose Yes and dont display from source by choose No
				</span>	
			</p>
			<p>
				<%=listError[1]!=null?"<span style=\"color: red\">"+listError[1]+"</span><br/>":"" %>
				<label> Selector of Title Link
				&nbsp;<img alt="Question" src="/images/i-help.gif" class="question"/>
				<span class="note">
					Choose Newest Article of Blog. Then, Input Selector format tag to get Title Link: "class" by "." + name of class - "id" by "#" + name of id . Example : http://abc.com/getSelector
				</span>
				<br /> <input class="input" type="text"
					name="reglink" id="reglink" value="<%=request.getAttribute("reglink")!=null?request.getAttribute("reglink"):""%>"/> </label>
			</p>
			<p>
				<%=listError[2]!=null?"<span style=\"color: red\">"+listError[2]+"</span><br/>":"" %>
				<label> Selector of Title
				&nbsp;<img alt="Question" src="/images/i-help.gif" class="question"/>
				<span class="note">
					Click to the tilte link to redirect details page that you chose Newest Article. Then, input Selector format tag to get Title.
				</span>
				<br /> <input class="input"
					type="text" name="regtitle" id="regtitle" value="<%=request.getAttribute("regtitle")!=null?request.getAttribute("regtitle"):""%>"/> </label>
			</p>
			<p>
				<%=listError[3]!=null?"<span style=\"color: red\">"+listError[3]+"</span><br/>":"" %>
				<label> Selector of Content
				&nbsp;<img alt="Question" src="/images/i-help.gif" class="question"/>
				<span class="note">
					Input Selector format tag to get Content of Newest Article.
				</span>
				<br /> <input class="input"
					type="text" name="regcontent" id="regcontent" value="<%=request.getAttribute("regcontent")!=null?request.getAttribute("regcontent"):""%>"/> </label>
			</p>
			<p>
				<label> Selector To Remove
				&nbsp;<img alt="Question" src="/images/i-help.gif" class="question"/>
				<span class="note">
					Input Selector format tag to remove a part of Content of Newest Article that you don't want. 
					
				</span>
				<br /> <input class="input"
					type="text" name="regremove" id="regremove" value="<%=request.getAttribute("regremove")!=null?request.getAttribute("regremove"):""%>"/> </label>
			</p>
			<p>
				<input type="submit" value="submit" />
			</p>
			<a href="javascript:void(0)" id="checklink">Preview Article</a> First, previewing your Article is ok before click Submit Button
		</form>
	</div>
	<div class="howdy">
		Howdy : <b><%=dbObject.get("username") %></b> <br />
		<%=dbObject.get("domain")!=null?"Site : <b>"+dbObject.get("domain")+"</b><br />":"" %> 
		<%=dbObject.get("blogid")!=null?"Blog id : <b>"+dbObject.get("blogid")+"</b><br />":"" %>
		Type : <b><%=dbObject.get("type") %></b> <br />
		<a href="/get-content">Get Special Content</a> <br /> 
		<a href="/edit-profile">Edit profile</a> <br />
		<a href="/logout">Logout</a> <br /> 
		<br/>
		<strong>List link</strong>
		<div class="listlink">
			<ul>
				<%
				while(cursor.hasNext())
				{
					DBObject object = cursor.next();
				%>
					<li> - <a href="/view?link=<%=URLEncoder.encode(object.get("sitemap").toString()) %>"><%=object.get("sitemap") %></a></li>
				<%
				}
				%>
			</ul>
		</div>
	</div>
	<div class="clearbreak"></div>
	<hr />
	<div class="checkresult">
		
		
	</div>
</div>

<script type="text/javascript" src="/js/addlink.js"></script>
<%@ include file='/layout/footer.jsp'%>